<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="js/js.cookie.js"></script>
</head>
<body>
    <form action="">
        <p>用户名<input name="uname"></p>
        <p>密码<input name="upwd"></p>
        <p><input type="checkbox" name="cbx">免十天登录</p>
        <p><button>登录</button></p>
    </form>
    <script>
        document.forms[0].onsubmit=function(){
            if(this.cbx.checked){
                var oUser={ name:this.uname.value , pwd:this.upwd.value }
                Cookies.set("logins",oUser,{expires:10});
            }
            return false;
        }

        window.onload=function(){           
            var oUser=JSON.parse(Cookies.get("logins")||"{}");
            if(oUser.name){
                document.forms[0].uname.value=oUser.name;
                document.forms[0].Upwd.value=oUser.pwd;
            }
        }
    </script>
</body>
</html>